10 CLS:KEY OFF          ' 1802pic2.bas
20 DIM D(176),F1(15),B(793):V=1
30 FOR I=1 TO 176:READ D(I):NEXT I:SCREEN 2
40 LINE (0,0)-(2,2),15,BF:GET (0,0)-(2,2),F1:CLS
50 CLS:X=0:Y=0
60 FOR I=1 TO 176:C=D(I):X$=""
70 FOR J=1 TO 8:Q=INT(C/2):R=C-2*Q
80 IF R=1 THEN X$="1"+X$ ELSE X$=" "+X$
90 C=Q
100 NEXT J
110 FOR D=1 TO 8:IF MID$(X$,D,1)="1" THEN PUT(X,Y),F1,PSET
120 X=X+3
130 NEXT D:IF I/8=INT(I/8) THEN X=0:Y=Y+3
140 NEXT I
150 DELAY=1/2:START=TIMER:WHILE TIMER<START+DELAY:WEND
160 GET (0,0)-(191,65),B:CLS:BX=5:BY=5:DX=1:DY=1
170 ON V GOTO 200,180,190
180 PUT (0,0),B,XOR:GOTO 200
190 PUT (1,1),B,XOR                  ' To erase picture
200 IF BY>137 OR BY<5 THEN DY=-1*DY  ' 200 -  65 = 135   <138 OK
210 IF BX>451 OR BX<5 THEN DX=-1*DX  ' 640 - 191 = 449   <451 OK
220 OBX=BX:OBY=BY:BX=BX+DX:BY=BY+DY
230 PUT (OBX-4,OBY-4),B,XOR:PUT (BX-4,BY-4),B,XOR
240 DELAY=1/100:START=TIMER:WHILE TIMER<START+DELAY:WEND
250 W$=INKEY$:IF W$="" THEN 200
260 IF W$=CHR$(49) THEN V=1:GOTO 50
270 IF W$=CHR$(50) THEN V=2:GOTO 50
280 IF W$=CHR$(51) THEN V=3:GOTO 50
290 IF W$=CHR$(27) THEN SCREEN 0:CLS:END
300 GOTO 200
